﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
//using System.Web.Configuration;
using System.Configuration;

namespace TBlog.Helpers
{
    public static class Language
    {
        public static string site_title { get; set; }
        public static string site_description { get; set; }
        public static string site_category { get; set; }
        public static string site_meta { get; set; }
        public static string site_about { get; set; }
        public static string site_page { get; set; }

        public static void SetLanguage()
        {

            // read
            string title = ConfigurationManager.AppSettings["site_title"];

            Configuration config;
            config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            config.AppSettings.Settings["site_title"].Value = "my title";
            config.Save(ConfigurationSaveMode.Modified);
            ConfigurationManager.RefreshSection("appSettings");

            site_title = ConfigurationManager.AppSettings["title"];
            site_description = ConfigurationManager.AppSettings["description"];
            site_category = ConfigurationManager.AppSettings["category"];

            //System.Configuration.AppSettingsSection appSettings = System.Configuration.d;
            //appSettings.Settings.Add("a", "aaaaaaa");
            
            //config.GetSection("appSettings");
        }
    }
}

